package com.martin.animation;

 import com.martin.C;

import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.LayoutAnimationController;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;

public class MyAnimation {
	private static AnimationSet set;
	private static Animation animation;
	private static LayoutAnimationController controller;

	public	static LayoutAnimationController getZoomOutThenZoomIntAnimat() {
		set = new AnimationSet(true);

		// -----------------------ZoomIntThenZoomOut
		animation = new ScaleAnimation(1.0f, 0.8f, 1.0f, 0.8f,
				Animation.RELATIVE_TO_SELF, 0.3f, Animation.RELATIVE_TO_SELF, 1);
		animation.setDuration(100);
		set.addAnimation(animation);

		animation = new AlphaAnimation(1.0f, 0.5f);
		animation.setDuration(100);
		set.addAnimation(animation);

		animation = new ScaleAnimation(1.0f, 1.25f, 1.0f, 1.25f,
				Animation.RELATIVE_TO_SELF, 0.3f, Animation.RELATIVE_TO_SELF, 1);
		animation.setStartOffset(100);
		animation.setDuration(100);
		 C.astaticAnimation=animation;
		set.addAnimation(animation);

		controller = new LayoutAnimationController(set, 0.5f);
		return controller;
	}

	public static LayoutAnimationController getZoomIntThenZoomOutAnimat() {
		set = new AnimationSet(true);
		animation = new AlphaAnimation(0.0f, 1f);
		animation.setDuration(200);
		set.addAnimation(animation);
		animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f,
				Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
				-1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
		animation.setDuration(200);
		set.addAnimation(animation);

		// -----------------------ZoomIntThenZoomOut
		animation = new ScaleAnimation(1.0f, 1.25f, 1.0f, 1.25f,
				Animation.RELATIVE_TO_SELF, 0.3f, Animation.RELATIVE_TO_SELF, 1);
		animation.setDuration(200);
		animation.setStartOffset(200);
		set.addAnimation(animation);
		animation = new ScaleAnimation(1.0f, 0.8f, 1.0f, 0.8f,
				Animation.RELATIVE_TO_SELF, 0.3f, Animation.RELATIVE_TO_SELF, 1);
		animation.setStartOffset(400);
		animation.setDuration(200);
		 C.astaticAnimation=animation;
		set.addAnimation(animation);

		controller = new LayoutAnimationController(set, 0.5f);
		return controller;
	}
}
